'use strict';
/**
 * @param app
 * @returns { void|never|sequelize.Model<any, any, TAttributes>|* }
 */
module.exports = app => {
  const { INTEGER, STRING, TEXT } = app.Sequelize;

  const Permission = app.model.define('permission', {
    permission_id: {
      type: STRING,
      primaryKey: true,
      unique: true,
    },
    permission_name: STRING,
    describe: STRING,
    status: {
      type: INTEGER,
      defaultValue: 1,
    },
    action_data: TEXT,
    spt_da_types: STRING,
    optional_fields: {
      type: STRING,
      field: 'optional_fields',
    },
    parents: STRING,
    type: {
      type: STRING,
      defaultValue: 'default',
    },
    deleted: {
      type: INTEGER,
      defaultValue: 0,
    },
    actions: STRING,
    action_entity_set: STRING,
  }, {
    timestamps: false,
    tableName: 'l_permission',
  });

  return Permission;
}
